package com.xxx.coll;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * @version v1.0
 * @Description
 * @Author admin
 * @date 2021/7/20  14:51
 * @Copyright
 */
public class ArrsyListDome {
    public static void main(String[] args) {
        ArrayList arrayList = new ArrayList();
        arrayList.add(new Student("李四",20));
        arrayList.add(new Student("张三",30));
        arrayList.add(new Student("王五",40));
        arrayList.add(new Student("钱六",50));
        //System.out.println("arrayList = " + arrayList);
       // System.out.println(new Student("王五",40).equals(new Student("王五",40)));
        for (int i = 0; i < arrayList.size(); i++) {
            Student Student = (Student)arrayList.get(i);
            System.out.println(Student.getName());
        }

        Iterator iterator = arrayList.iterator();
        while (iterator.hasNext()){
            Student student = (Student) iterator.next();
            System.out.println("student = " + student.getName());
        }

    }
}
